package com.enhe.gck.pojo;

import com.alibaba.fastjson.annotation.JSONField;
import com.enhe.gck.item.SupplyOrderHWANE16829Item;
import com.kuangkie.carbon.record.Updatable;
import com.kuangkie.carbon.record.annotation.Attribute;
import com.kuangkie.carbon.record.annotation.CarbonRecord;
import com.kuangkie.carbon.record.annotation.RecordCode;
import com.kuangkie.carbon.record.annotation.Relation;
import com.kuangkie.carbon.uid.model.UidManager;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

import static com.enhe.gck.CarbonRelationType.*;

// 供货订单
@Data
@CarbonRecord("hwane16829")
public class SupplyOrder implements Updatable {
    @JSONField(name = "唯一编码")
    @RecordCode
    private Long id = UidManager.getLongUID();

    // 单号
    @JSONField(name = "单号")
    @Attribute("hwan16831")
    private String order;

    // 8位取货码
    @JSONField(name = "8位取货码")
    @Attribute("hwan16832")
    private String pickupCode;

//    // 重量
//    @JSONField(name = "重量")
//    @Attribute("hwan16833")
//    private Double weight;

    // 是否作废
    @JSONField(name = "是否作废")
    @Attribute("hwan16835")
    private String isCancel;

    // 是否退货
    @JSONField(name = "是否退货")
    @Attribute("hwan16836")
    private String isRefund;

    // IC卡号
    @JSONField(name = "IC卡号")
    @Attribute("hwan16837")
    private String icCard;

    // 状态
    @JSONField(name = "状态")
    @Attribute("hwan16838")
    private String state;

//    // 运费
//    @JSONField(name = "运费")
//    @Attribute("hwan16839")
//    private Double fare;

    // 是否扣重
    @JSONField(name = "是否扣重")
    @Attribute("hwan16884")
    private boolean isWeightDeduction;

    // 订单来源
    @JSONField(name = "订单来源")
    @Attribute("hwan18023")
    private String orderSource;

    // 是否已开票
    @JSONField(name = "是否已开票")
    @Attribute(SupplyOrderHWANE16829Item.基本属性组_是否已开票)
    private Boolean invoicedFlag;

    // 是否验收
    @JSONField(name = "是否验收")
    @Attribute("hwan18073")
    private boolean isCheck;
    // 是否化验室化验
    @JSONField(name = "是否化验室化验")
    @Attribute("hwan18074")
    private boolean isTest;

    @JSONField(name = "皮重")
    @Attribute("hwan18117")
    private Double weightTare;

    // 毛重
    @JSONField(name = "毛重")
    @Attribute("hwan18118")
    private Double weightGross;

    // 实际重量
    @JSONField(name = "实际重量")
    @Attribute("hwan16848")
    private Double actualWeight;

    @JSONField(name = "录入类型")
    @Attribute("hwan18264")
    private String inputType;
    @JSONField(name = "录入类型")
    @Attribute("hwan19887")
    private String type;

    @JSONField(name = "过磅1重量")
    @Attribute("hwan18399")
    private Double weight1;
    @JSONField(name = "过磅2重量")
    @Attribute("hwan18401")
    private Double weight2;
    @JSONField(name = "过磅1时间")
    @Attribute("hwan18398")
    private LocalDateTime weight1Time;
    @JSONField(name = "过磅2时间")
    @Attribute("hwan18400")
    private LocalDateTime weight2Time;
    @JSONField(name = "命令")
    @Attribute("hwan18406")
    private String command;

    // 发卡时间
    @JSONField(name = "发卡时间")
    @Attribute(SupplyOrderHWANE16829Item.基本属性组_发卡时间)
    private LocalDateTime cardIssuanceTime;

    // 收卡时间
    @JSONField(name = "收卡时间")
    @Attribute(SupplyOrderHWANE16829Item.基本属性组_收卡时间)
    private LocalDateTime cardCollectionTime;


    // 是否已打印小票
    @JSONField(name = "是否已打印小票")
    @Attribute(SupplyOrderHWANE16829Item.基本属性组_是否已打印小票)
    private Boolean receiptPrintedFlag;

    // 小票打印次数
    @JSONField(name = "小票打印次数")
    @Attribute(SupplyOrderHWANE16829Item.基本属性组_小票打印次数)
    private Integer receiptPrintedNumber;

    @JSONField(name = "完成时间")
    @Attribute("hwan19298")
    private LocalDateTime finishTime;

    @JSONField(name = "批量下单")
    @Attribute("hwan21121")
    private Boolean batch;
    @JSONField(name = "每车单数")
    @Attribute("hwan21122")
    private Integer saveNumber;

    @JSONField(name = "容积(升)")
    @Attribute("hwan21184")
    private BigDecimal liter;

    @JSONField(name = "转换升")
    @Attribute("hwan21298")
    private Boolean isToLiter;

    @JSONField(name="密度(g/ml)")
    @Attribute("hwan21299")
    private BigDecimal density;

    @Attribute("hwane16829_cd")
    private LocalDateTime createTime;

    @Relation(RR_供货订单_客户名称_客户管理)
    private Customer customer;
    @Relation(RR_供货订单_客户名称_客户管理)
    private Long customerId;

    @Relation(RR_供货订单_供货计划_供货计划)
    private SupplyOrderBig supplyOrderBig;
    @Relation(RR_供货订单_供货计划_供货计划)
    private Long supplyOrderBigId;

    @Relation(RR_供货订单_供货订单的运输商_客户管理)
    private Customer transporterCustomer;
    @Relation(RR_供货订单_供货订单的运输商_客户管理)
    private Long transporterCustomerId;
    @Relation(RR_供货订单_车牌号_车辆管理)
    private Car car;
    @Relation(RR_供货订单_车牌号_车辆管理)
    private Long carId;
    @Relation(RR_供货订单_物料名_物料管理)
    private Material material;
    @Relation(RR_供货订单_物料名_物料管理)
    private Long materialId;
    @Relation(RR_供货订单_司机_司机管理)
    private Driver driver;
    @Relation(RR_供货订单_司机_司机管理)
    private Long driverId;

    @Override
    public String getRecordCode() {
        return this.id == null ? null : this.id.toString();
    }
}